package xyz.zq.cloud.common.core.util;

import lombok.experimental.UtilityClass;
import xyz.zq.cloud.common.core.constant.CommonConstants;

/**
 * @author hzq
 * @date 2020/5/18 22:15
 */
@UtilityClass
public class AccountUtil {

    public R<String[]> checkUserName(String username) {

        int index = username.lastIndexOf(CommonConstants.SUFFIX_DELIMITER);

        if (index == -1)
            R.failed(String.format("用户信息为空 %s", username));

        String _username = username.substring(0, index);

        String _suffix = username.substring(index);

        String[] strings = {_username, _suffix};

        return R.ok(strings);
    }
}
